﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/online-rounds">课程管理</a></li>
          <li class="active">课件管理</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title="分组模板详情"></i>&nbsp;&nbsp;<span>课程排期&nbsp;-&nbsp;上课课件</span></h2>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper top-margin-20" style="position: relative;">
              <ul class="nav nav-pills x-breadcrumb-nav">
                <li role="presentation" >
                  <a href="${ctx.host}/year-rounds/${roundId}?status=${status}" role="tab" >基本信息</a>
               </li>
             <li class="pull-left ${type == 'weekly' ? 'active' : ''}"><a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/1?type=weekly&status=${status}">家庭作业</a></li>
               <li class="pull-left ${type == 'course' ? 'active' : ''}"><a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/1?type=course&status=${status}&day=1">上课课件</a></li>
               <c:if test="${status!='prepare'}">
                 <li role="presentation" >
                   <a href="${ctx.host}/year-rounds/${roundId}/physical-data?status=${status}" role="tab" >身体数据</a>
                 </li>
               </c:if>
               <div class=" pull-right courseware-btn">
                 <c:if test="${!dailyCourseware.editStatus.generated and not currentPrincipal.coursewareMonitor}">
                  <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${batchCourseware.id}/link?type=${type}&day=${dailyCourseware.sorting}" data-target="#offline-link" data-toggle="modal">发送课件</a>
                 </c:if>
                  <%-- <c:if test="${batchCourseware.editStatus.prepare}">
                    <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${batchCourseware.id}/save-all" data-target="#save-all" data-toggle="modal">全部保存</a>
                  </c:if> --%>
                  <c:if test="${not empty batchCourseware.courseRound.student.tagIds and not currentPrincipal.coursewareMonitor}">
                    <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${batchCourseware.id}/edit-tags" data-target="#edit-tags" data-toggle="modal">修改标签</a>
                  </c:if>
                </div>
             </ul>
          </div>
          
          <div class="clearfix">
          
          <div class="row" >
          
            <div class="col-xs-2 template-submenu">
              <ul class="nav nav-pills nav-stacked template-list">
                <c:forEach var="daily" items="${persist.dailyCourseware(batchCourseware.id)}">
                  <li class="submenu text-center ${day == daily.sorting ? 'active' : ''}"><a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${batchCourseware.sorting}?type=${type}&status=${courseRound.courseStatus.alias}&day=${daily.sorting}">${daily.name}</a></li>
                </c:forEach>
              </ul>
            </div>
            
            <div class="col-xs-7">
              <div class="schedule-action-layout">
                  <div class="action-module">
                    <label class="text-right">${dailyCourseware.name}:</label>
                    <c:set var="coursewares" value="${persist.coursewareArray(dailyCourseware.id)}"/>
                    <c:choose>
                      <c:when test="${empty dailyCourseware.type or (not dailyCourseware.type.rest and empty coursewares)}">
                        <div class="compile-action text-center">
                          <c:if test="${not currentPrincipal.coursewareMonitor}">
                            <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/create?coursewareType=course" class="btn btn-default btn-shadow-default" data-toggle="modal" data-target="#create">添加动作</a>
                            <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/action-group?coursewareType=course" class="btn btn-default btn-shadow-default" data-toggle="modal" data-target="#action-group">添加动作组</a>
                            <c:if test="${type == 'weekly'}">
                              <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/rest" class="btn btn-rest btn-success btn-shadow-default" data-toggle="modal" data-target="#rest">设为休息日</a>
                            </c:if>
                          </c:if>
                        </div>
                      </c:when>
                      <c:when test="${dailyCourseware.type.rest and empty coursewares}">
                        <div class="compile-action">
                          <p class="rest text-center">今日休息
                            <c:if test="${not currentPrincipal.coursewareMonitor}">
                              <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/create?coursewareType=course" class="" data-toggle="modal" data-target="#create">重新添加动作</a>
                              <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/action-group?coursewareType=course" class="" data-toggle="modal" data-target="#action-group">重新添加动作组</a>
                            </c:if>
                          </p>
                        </div>
                      </c:when>
                      <c:otherwise>
                        <div class="compile-action clearfix">
                          <div class="row">
                            <label class="text-left">所有动作：</label>
                            <div class="action-item">
                              <c:forEach var="courseware" items="${coursewares}">
                                <div class="action-layout">
                                  <c:if test="${not currentPrincipal.coursewareMonitor}">
                                    <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/${courseware.id}/edit" class="add-action" data-toggle="modal" data-target="#edit">
                                  </c:if>
                                    <div class="action-cover">
                                      <img src="${cloud.prod}/${courseware.movement.cover}-0.6" alt="">
                                      <p>${courseware.movement.name}</p>
                                    </div>
                                    <p>
                                      <c:if test="${courseware.groupAmount != 0}">${formal.groupAmount}组&nbsp;&nbsp;</c:if>
                                      <c:if test="${courseware.movementNumber != 0}">每组${formal.movementNumber}次&nbsp;&nbsp;</c:if>
                                      <c:if test="${not empty courseware.maxWeight}">最大重量：${formal.maxWeight}KG&nbsp;&nbsp;</c:if>
                                      <c:if test="${not empty courseware.time}">计时${formal.time}秒</c:if>
                                    </p>
                                  <c:if test="${not currentPrincipal.coursewareMonitor}">
                                    </a>
                                    <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/${courseware.id}/delete" class="close-module" data-toggle="modal" data-target="#delete"></a>
                                  </c:if>
                                </div>
                              </c:forEach>
                              <c:if test="${not currentPrincipal.coursewareMonitor}">
                                <div class="action-layout">
                                  <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/create?coursewareType=course" class="add-module" data-toggle="modal" data-target="#create">
                                    <div class="action-add">
                                      <img src="${ctx.resource}/images/add.png" alt="">添加动作
                                    </div>
                                  </a>
                                </div>
                                <div class="action-layout">
                                  <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/coursewares/action-group?coursewareType=course" class="add-module" data-toggle="modal" data-target="#action-group">
                                    <div class="action-add">
                                      <img src="${ctx.resource}/images/add.png" alt="">添加动作组
                                    </div>
                                  </a>
                                </div>
                              </c:if>
                            </div>
                          </div>
                          <c:if test="${not currentPrincipal.coursewareMonitor}">
                            <div class="compile-action text-center">
                              <a href="${ctx.host}/year-rounds/${roundId}/batch-coursewares/${weeks}/daily-coursewares/${dailyCourseware.id}/rest" class="btn btn-rest btn-success btn-shadow-default" data-toggle="modal" data-target="#rest">设为休息日</a>
                            </div>
                          </c:if>
                        </div>
                      </c:otherwise>
                    </c:choose>
                  </div>
              
              </div>
            </div>
            
            <div class="col-xs-3">
              <div class="diet-layout" style="margin-left:25px;">
                <label>Tips:</label>
                <p>${batchCourseware.coachTips}</p>
              </div>
              
            </div>
            
          </div>
          </div>
          
        </div>
          
        </div>

      </div>

    </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/course/batch-courseware.js">
    <script type="text/javascript">
      require(['page/course/batch-courseware'], function(page) {
        page.init({
          "roundId": "${roundId}",
            "roundCode": "${roundCode}",
            "batchId": "${batchCourseware.id}",
            "type": 'year'
        })
      })
    </script>
  </d:resource>
  
</body>

</html>
